<?php 
     $conn = oci_connect("hospital", "hospital", "//localhost/XE"); 
    $pull = oci_parse($conn, "select * from staff where stf_id = $_GET[id]");
    oci_execute($pull);
    $job = oci_fetch_array($pull,OCI_RETURN_LOBS );
    
   // echo $job['JOB_TYPE'];
    
        if($job['JOB_TYPE'] == 'DOC'){
            $sel = oci_parse($conn, "select * from DOCTORS where st_id = $_GET[id]");
            oci_execute($sel);
            $d_type = oci_fetch_array($sel,OCI_RETURN_LOBS);
            
            if($d_type['DOCTORTYPE'] == 'GEN'){
                $dell = oci_parse($conn, "delete from GENERAL_PRACTICE where std_id = '$_GET[id]'");              
            }else if($d_type['DOCTORTYPE'] == 'ANE'){
                $dell = oci_parse($conn, "delete from ANESTHESISTS where std_id = '$_GET[id]'");               
            }else if($d_type['DOCTORTYPE'] == 'SUR'){
                $dell = oci_parse($conn, "delete from SURGEONS where std_id = '$_GET[id]'");               
            }
            oci_execute($dell);
            
            $deleted = oci_parse($conn, "delete from DOCTORS where ST_ID = '$_GET[id]'");
            oci_execute($deleted);
        
            
        }else if($job['JOB_TYPE'] == 'NUR'){
            $deleten = oci_parse($conn, "delete from NURSES where ST_ID = '$_GET[id]'");
            oci_execute($deleten);
        }else if($job['JOB_TYPE'] == 'EXE'){
            $deletee = oci_parse($conn, "delete from executives where ST_ID = '$_GET[id]'");
            oci_execute($deletee);
        }else if($job['JOB_TYPE'] == 'FIN'){
            $deleted = oci_parse($conn, "delete from finances where ST_ID = '$_GET[id]'");
            oci_execute($deleted);
        }
        
        $delete = oci_parse($conn, "delete from staff where STF_ID = '$_GET[id]'");
	oci_execute($delete);
        
 ?>
 
  <HTML>
 <head><meta http-equiv="refresh" content="1; URL=main.php"></head>
<BODY>
 Going Back to the table
 </BODY>
 </HTML>
